import request from './base';
import Storage from '../vendors/Storage.js';

// 测试
export const getDelay = params => {
    let rtn = Date.now(),
        delay = params.delay || 200;
    return new Promise(resolve => {
        setTimeout(() => {
            resolve(rtn);
        }, delay);
    });
};

export const modulesGet = module => request.send(process.env.VUE_APP_RESTFUL_URL + `/${module}`);

/**
 * settings
 * @date 2019.8.1
 */
export async function getSettings() {
    let res = await modulesGet('settings');
    Storage.getSessionStorage('SETTINGS').set('settings', res);
    return Promise.resolve(res);
}
